/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = '';
  
  checkConfig(config);
  @endpoint = getEndpoint('ots', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model BindInstance2VpcRequest {
  instanceName?: string(name='InstanceName'),
  instanceVpcName?: string(name='InstanceVpcName'),
  network?: string(name='Network'),
  regionNo?: string(name='RegionNo'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  virtualSwitchId?: string(name='VirtualSwitchId'),
  vpcId?: string(name='VpcId'),
}

model BindInstance2VpcResponseBody = {
  domain?: string(name='Domain'),
  endpoint?: string(name='Endpoint'),
  requestId?: string(name='RequestId'),
}

model BindInstance2VpcResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: BindInstance2VpcResponseBody(name='body'),
}

async function bindInstance2VpcWithOptions(request: BindInstance2VpcRequest, runtime: Util.RuntimeOptions): BindInstance2VpcResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceName)) {
    query['InstanceName'] = request.instanceName;
  }
  if (!Util.isUnset(request.instanceVpcName)) {
    query['InstanceVpcName'] = request.instanceVpcName;
  }
  if (!Util.isUnset(request.network)) {
    query['Network'] = request.network;
  }
  if (!Util.isUnset(request.regionNo)) {
    query['RegionNo'] = request.regionNo;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!Util.isUnset(request.virtualSwitchId)) {
    query['VirtualSwitchId'] = request.virtualSwitchId;
  }
  if (!Util.isUnset(request.vpcId)) {
    query['VpcId'] = request.vpcId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'BindInstance2Vpc',
    version = '2016-06-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function bindInstance2Vpc(request: BindInstance2VpcRequest): BindInstance2VpcResponse {
  var runtime = new Util.RuntimeOptions{};
  return bindInstance2VpcWithOptions(request, runtime);
}

model DeleteInstanceRequest {
  instanceName?: string(name='InstanceName'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
}

model DeleteInstanceResponseBody = {
  requestId?: string(name='RequestId'),
}

model DeleteInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteInstanceResponseBody(name='body'),
}

async function deleteInstanceWithOptions(request: DeleteInstanceRequest, runtime: Util.RuntimeOptions): DeleteInstanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceName)) {
    query['InstanceName'] = request.instanceName;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteInstance',
    version = '2016-06-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deleteInstance(request: DeleteInstanceRequest): DeleteInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteInstanceWithOptions(request, runtime);
}

model DeleteTagsRequest {
  instanceName?: string(name='InstanceName'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  tagInfo?: [ 
    {
      tagKey?: string(name='TagKey'),
      tagValue?: string(name='TagValue'),
    }
  ](name='TagInfo'),
}

model DeleteTagsResponseBody = {
  requestId?: string(name='RequestId'),
}

model DeleteTagsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteTagsResponseBody(name='body'),
}

async function deleteTagsWithOptions(request: DeleteTagsRequest, runtime: Util.RuntimeOptions): DeleteTagsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceName)) {
    query['InstanceName'] = request.instanceName;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!Util.isUnset(request.tagInfo)) {
    query['TagInfo'] = request.tagInfo;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteTags',
    version = '2016-06-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deleteTags(request: DeleteTagsRequest): DeleteTagsResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteTagsWithOptions(request, runtime);
}

model GetInstanceRequest {
  instanceName?: string(name='InstanceName'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
}

model GetInstanceResponseBody = {
  instanceInfo?: {
    clusterType?: string(name='ClusterType'),
    createTime?: string(name='CreateTime'),
    description?: string(name='Description'),
    instanceName?: string(name='InstanceName'),
    network?: string(name='Network'),
    quota?: {
      entityQuota?: int32(name='EntityQuota'),
    }(name='Quota'),
    readCapacity?: int32(name='ReadCapacity'),
    status?: int32(name='Status'),
    tagInfos?: {
      tagInfo?: [ 
      {
        tagKey?: string(name='TagKey'),
        tagValue?: string(name='TagValue'),
      }
    ](name='TagInfo')
    }(name='TagInfos'),
    userId?: string(name='UserId'),
    writeCapacity?: int32(name='WriteCapacity'),
  }(name='InstanceInfo'),
  requestId?: string(name='RequestId'),
}

model GetInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetInstanceResponseBody(name='body'),
}

async function getInstanceWithOptions(request: GetInstanceRequest, runtime: Util.RuntimeOptions): GetInstanceResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetInstance',
    version = '2016-06-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getInstance(request: GetInstanceRequest): GetInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return getInstanceWithOptions(request, runtime);
}

model GetOtsServiceStatusRequest {
  ownerId?: long(name='OwnerId'),
}

model GetOtsServiceStatusResponseBody = {
  data?: boolean(name='Data'),
  dynamicCode?: string(name='DynamicCode'),
  dynamicMessage?: string(name='DynamicMessage'),
  errCode?: string(name='ErrCode'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model GetOtsServiceStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetOtsServiceStatusResponseBody(name='body'),
}

async function getOtsServiceStatusWithOptions(request: GetOtsServiceStatusRequest, runtime: Util.RuntimeOptions): GetOtsServiceStatusResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetOtsServiceStatus',
    version = '2016-06-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getOtsServiceStatus(request: GetOtsServiceStatusRequest): GetOtsServiceStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  return getOtsServiceStatusWithOptions(request, runtime);
}

model InsertInstanceRequest {
  clusterType?: string(name='ClusterType', example='HYBRID'),
  description?: string(name='Description'),
  instanceName?: string(name='InstanceName', example='rec-ots-demo-002'),
  network?: string(name='Network', example='VPC_CONSOLE'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  tagInfo?: [ 
    {
      tagKey?: string(name='TagKey', example='Environment'),
      tagValue?: string(name='TagValue', example='hangzhou'),
    }
  ](name='TagInfo'),
}

model InsertInstanceResponseBody = {
  requestId?: string(name='RequestId', example='C8CE3585-A59B-55E9-BC00-02823DD29217'),
}

model InsertInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: InsertInstanceResponseBody(name='body'),
}

async function insertInstanceWithOptions(request: InsertInstanceRequest, runtime: Util.RuntimeOptions): InsertInstanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clusterType)) {
    query['ClusterType'] = request.clusterType;
  }
  if (!Util.isUnset(request.description)) {
    query['Description'] = request.description;
  }
  if (!Util.isUnset(request.instanceName)) {
    query['InstanceName'] = request.instanceName;
  }
  if (!Util.isUnset(request.network)) {
    query['Network'] = request.network;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!Util.isUnset(request.tagInfo)) {
    query['TagInfo'] = request.tagInfo;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'InsertInstance',
    version = '2016-06-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function insertInstance(request: InsertInstanceRequest): InsertInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return insertInstanceWithOptions(request, runtime);
}

model InsertTagsRequest {
  instanceName?: string(name='InstanceName'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  tagInfo?: [ 
    {
      tagKey?: string(name='TagKey'),
      tagValue?: string(name='TagValue'),
    }
  ](name='TagInfo'),
}

model InsertTagsResponseBody = {
  requestId?: string(name='RequestId'),
}

model InsertTagsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: InsertTagsResponseBody(name='body'),
}

async function insertTagsWithOptions(request: InsertTagsRequest, runtime: Util.RuntimeOptions): InsertTagsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceName)) {
    query['InstanceName'] = request.instanceName;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!Util.isUnset(request.tagInfo)) {
    query['TagInfo'] = request.tagInfo;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'InsertTags',
    version = '2016-06-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function insertTags(request: InsertTagsRequest): InsertTagsResponse {
  var runtime = new Util.RuntimeOptions{};
  return insertTagsWithOptions(request, runtime);
}

model ListClusterTypeRequest {
  resourceOwnerId?: long(name='ResourceOwnerId'),
}

model ListClusterTypeResponseBody = {
  clusterTypeDetailList?: {
    clusterTypeDetail?: [ 
    {
      clusterType?: string(name='ClusterType'),
      isMultiAZ?: boolean(name='IsMultiAZ'),
    }
  ](name='ClusterTypeDetail')
  }(name='ClusterTypeDetailList'),
  clusterTypeInfos?: {
    clusterType?: [ string ](name='ClusterType')
  }(name='ClusterTypeInfos'),
  requestId?: string(name='RequestId'),
}

model ListClusterTypeResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListClusterTypeResponseBody(name='body'),
}

async function listClusterTypeWithOptions(request: ListClusterTypeRequest, runtime: Util.RuntimeOptions): ListClusterTypeResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListClusterType',
    version = '2016-06-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listClusterType(request: ListClusterTypeRequest): ListClusterTypeResponse {
  var runtime = new Util.RuntimeOptions{};
  return listClusterTypeWithOptions(request, runtime);
}

model ListInstanceRequest {
  pageNum?: long(name='PageNum'),
  pageSize?: long(name='PageSize'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  tagInfo?: [ 
    {
      tagKey?: string(name='TagKey'),
      tagValue?: string(name='TagValue'),
    }
  ](name='TagInfo'),
}

model ListInstanceResponseBody = {
  instanceInfos?: {
    instanceInfo?: [ 
    {
      instanceName?: string(name='InstanceName'),
      timestamp?: string(name='Timestamp'),
    }
  ](name='InstanceInfo')
  }(name='InstanceInfos'),
  pageNum?: long(name='PageNum'),
  pageSize?: long(name='PageSize'),
  requestId?: string(name='RequestId'),
  totalCount?: long(name='TotalCount'),
}

model ListInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListInstanceResponseBody(name='body'),
}

async function listInstanceWithOptions(request: ListInstanceRequest, runtime: Util.RuntimeOptions): ListInstanceResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListInstance',
    version = '2016-06-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listInstance(request: ListInstanceRequest): ListInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return listInstanceWithOptions(request, runtime);
}

model ListTagsRequest {
  instanceName?: string(name='InstanceName'),
  pageNum?: long(name='PageNum'),
  pageSize?: long(name='PageSize'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  tagInfo?: [ 
    {
      tagKey?: string(name='TagKey'),
      tagValue?: string(name='TagValue'),
    }
  ](name='TagInfo'),
}

model ListTagsResponseBody = {
  pageNum?: long(name='PageNum'),
  pageSize?: long(name='PageSize'),
  requestId?: string(name='RequestId'),
  tagInfos?: {
    tagInfo?: [ 
    {
      tagKey?: string(name='TagKey'),
      tagValue?: string(name='TagValue'),
    }
  ](name='TagInfo')
  }(name='TagInfos'),
  totalCount?: long(name='TotalCount'),
}

model ListTagsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListTagsResponseBody(name='body'),
}

async function listTagsWithOptions(request: ListTagsRequest, runtime: Util.RuntimeOptions): ListTagsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceName)) {
    query['InstanceName'] = request.instanceName;
  }
  if (!Util.isUnset(request.pageNum)) {
    query['PageNum'] = request.pageNum;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!Util.isUnset(request.tagInfo)) {
    query['TagInfo'] = request.tagInfo;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListTags',
    version = '2016-06-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listTags(request: ListTagsRequest): ListTagsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listTagsWithOptions(request, runtime);
}

model ListVpcInfoByInstanceRequest {
  instanceName?: string(name='InstanceName'),
  pageNum?: long(name='PageNum'),
  pageSize?: long(name='PageSize'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
}

model ListVpcInfoByInstanceResponseBody = {
  instanceName?: string(name='InstanceName'),
  pageNum?: long(name='PageNum'),
  pageSize?: long(name='PageSize'),
  requestId?: string(name='RequestId'),
  totalCount?: long(name='TotalCount'),
  vpcInfos?: {
    vpcInfo?: [ 
    {
      domain?: string(name='Domain'),
      endpoint?: string(name='Endpoint'),
      instanceVpcName?: string(name='InstanceVpcName'),
      regionNo?: string(name='RegionNo'),
      vpcId?: string(name='VpcId'),
    }
  ](name='VpcInfo')
  }(name='VpcInfos'),
}

model ListVpcInfoByInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListVpcInfoByInstanceResponseBody(name='body'),
}

async function listVpcInfoByInstanceWithOptions(request: ListVpcInfoByInstanceRequest, runtime: Util.RuntimeOptions): ListVpcInfoByInstanceResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListVpcInfoByInstance',
    version = '2016-06-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listVpcInfoByInstance(request: ListVpcInfoByInstanceRequest): ListVpcInfoByInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return listVpcInfoByInstanceWithOptions(request, runtime);
}

model ListVpcInfoByVpcRequest {
  pageNum?: long(name='PageNum'),
  pageSize?: long(name='PageSize'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  tagInfo?: [ 
    {
      tagKey?: string(name='TagKey'),
      tagValue?: string(name='TagValue'),
    }
  ](name='TagInfo'),
  vpcId?: string(name='VpcId'),
}

model ListVpcInfoByVpcResponseBody = {
  pageNum?: long(name='PageNum'),
  pageSize?: long(name='PageSize'),
  requestId?: string(name='RequestId'),
  totalCount?: long(name='TotalCount'),
  vpcId?: string(name='VpcId'),
  vpcInfos?: {
    vpcInfo?: [ 
    {
      domain?: string(name='Domain'),
      endpoint?: string(name='Endpoint'),
      instanceName?: string(name='InstanceName'),
      instanceVpcName?: string(name='InstanceVpcName'),
      regionNo?: string(name='RegionNo'),
    }
  ](name='VpcInfo')
  }(name='VpcInfos'),
}

model ListVpcInfoByVpcResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListVpcInfoByVpcResponseBody(name='body'),
}

async function listVpcInfoByVpcWithOptions(request: ListVpcInfoByVpcRequest, runtime: Util.RuntimeOptions): ListVpcInfoByVpcResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListVpcInfoByVpc',
    version = '2016-06-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listVpcInfoByVpc(request: ListVpcInfoByVpcRequest): ListVpcInfoByVpcResponse {
  var runtime = new Util.RuntimeOptions{};
  return listVpcInfoByVpcWithOptions(request, runtime);
}

model OpenOtsServiceResponseBody = {
  orderId?: string(name='OrderId'),
  requestId?: string(name='RequestId'),
}

model OpenOtsServiceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: OpenOtsServiceResponseBody(name='body'),
}

async function openOtsServiceWithOptions(runtime: Util.RuntimeOptions): OpenOtsServiceResponse {
  var req = new OpenApi.OpenApiRequest{};
  var params = new OpenApi.Params{
    action = 'OpenOtsService',
    version = '2016-06-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function openOtsService(): OpenOtsServiceResponse {
  var runtime = new Util.RuntimeOptions{};
  return openOtsServiceWithOptions(runtime);
}

model UnbindInstance2VpcRequest {
  instanceName?: string(name='InstanceName'),
  instanceVpcName?: string(name='InstanceVpcName'),
  regionNo?: string(name='RegionNo'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
}

model UnbindInstance2VpcResponseBody = {
  requestId?: string(name='RequestId'),
}

model UnbindInstance2VpcResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UnbindInstance2VpcResponseBody(name='body'),
}

async function unbindInstance2VpcWithOptions(request: UnbindInstance2VpcRequest, runtime: Util.RuntimeOptions): UnbindInstance2VpcResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceName)) {
    query['InstanceName'] = request.instanceName;
  }
  if (!Util.isUnset(request.instanceVpcName)) {
    query['InstanceVpcName'] = request.instanceVpcName;
  }
  if (!Util.isUnset(request.regionNo)) {
    query['RegionNo'] = request.regionNo;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UnbindInstance2Vpc',
    version = '2016-06-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function unbindInstance2Vpc(request: UnbindInstance2VpcRequest): UnbindInstance2VpcResponse {
  var runtime = new Util.RuntimeOptions{};
  return unbindInstance2VpcWithOptions(request, runtime);
}

model UpdateInstanceRequest {
  instanceName?: string(name='InstanceName'),
  network?: string(name='Network'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
}

model UpdateInstanceResponseBody = {
  requestId?: string(name='RequestId'),
}

model UpdateInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateInstanceResponseBody(name='body'),
}

async function updateInstanceWithOptions(request: UpdateInstanceRequest, runtime: Util.RuntimeOptions): UpdateInstanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceName)) {
    query['InstanceName'] = request.instanceName;
  }
  if (!Util.isUnset(request.network)) {
    query['Network'] = request.network;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UpdateInstance',
    version = '2016-06-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function updateInstance(request: UpdateInstanceRequest): UpdateInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateInstanceWithOptions(request, runtime);
}

